<?php
/* @var $this DiscountController */

//行业一级分类
$cateTop = Category::model()->getTopCache();
//定义模型，用于取分类下最新促销产品
$model = new ProTuan('search');
$model->unsetAttributes();//清空属性
$model->zpt_status = 2;//审核状态为通过
$model->zpt_type = 2;//类型:1:团购2:秒杀3:限量抢购
$model->zpt_end_time = '>'.time();//结束时间大于当前时间
$model->zpt_close = 1;//是否关闭1否2是3删除

?>
<div class="grid_01 c_f">
	<div class="snapup_slide w_790 f_l">
		<div id="slideBox" class="slideimg">
			<ul id="slideContent">
				<?php $adzone = Adzone::model()->getData(41,$cid=0);?>
				<?php if(!empty($adzone)){foreach($adzone['ads'] as $key=>$val){?>
				<li>
					<?php echo CHtml::link(Tool::thumb($val["zds_file_url"],$adzone['zdz_width'],$adzone['zdz_height']),$val['zds_url'],array('alt'=>$val['zds_desc'],'target'=>'_blank'))?>
				</li>
				<?php }}?>
			</ul>
		</div>
		<ul id="slideTab" class="slidetab">
			<li>1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
			<li>5</li>
		</ul>
	</div>

	<div class="free_snapup w_170 f_r">
		<div class="hd bg_sale"><h2 class="fs_14 ff_yh c_white">免费抢购</h2></div>
		<!-- 推荐位-免费抢购 -->
		<?php $positdata = Positions::model()->getPosData('28');?>
		<?php if(!empty($positdata)){foreach($positdata as $data){?>
		<div class="bd">
			<div class="c_img c_img140">
				<?php echo CHtml::link(Tool::thumb($data->promotion->zpt_pic,140,140,$data->promotion->zpt_title),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
			</div>
			<p class="price fs_14 fw_b ff_yh c_orange t_c">&yen;<?php echo $data->promotion->zpt_price?></p>
			<p class="title_pro">
				<?php echo CHtml::link(mb_substr($data->promotion->zpt_title,0,20,'utf8'),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
			</p>
			<p class="buy t_c">
				<?php echo CHtml::link('立即抢购',array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'),array('class'=>'btn fs_14 fw_b')) ?>
			</p>
			<p class="count">限量：<?php echo $data->promotion->zpt_limit_nums?>件</p>
			<p class="c_999">还剩<strong class="c_orange"><?php echo $data->promotion->product->zp_inventory?></strong>件，赶快抢购！</p>
		</div>
		<?php }}?>
	</div>
</div>
<div class="hr_12"></div>
<!--准点抢购 start-->
<div class="time_snapup c_f bg_fff">
	<div id="timeSnapup">
		<div class="tab_hd">
			<h2 class="f_l bg_sale">准点抢购</h2>
			<ul class="c_f f_l">
				<li>10:00开抢</li>
				<li>15:00开抢</li>
				<li>20:30开抢</li>
			</ul>
		</div>
		<div class="tab_cont">
			<div class="today_snapup">
				<ul class="list c_f">
					<!-- 推荐位-准点抢购 10点-->
					<?php $positdata = Positions::model()->getPosData('29');?>
					<?php if(!empty($positdata)){foreach($positdata as $data){?>
					<li class="c_f">
						<div class="c_img c_img180">
							<?php echo CHtml::link(Tool::thumb($data->promotion->zpt_pic,180,180,$data->promotion->zpt_title),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
						</div>
						<p class="title c_666 fs_14 fw_b">
							<?php echo CHtml::link(mb_substr($data->promotion->zpt_title,0,20,'utf8'),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
						</p>
						<p class="buy c_f bg_sale">
						<a class="btn f_r" href="snapup_detail.html"></a><strong class="fs_24 ff_yh c_white">￥<?php echo $data->promotion->zpt_price?></strong>
						</p>
						<p class="other c_666">
							<span class="old_price">原价：<del class="fw_b"><?php echo $data->promotion->product->zp_price?></del>元</span>
							<span class="count">限量：<?php echo $data->promotion->zpt_limit_nums?>份</span>
						</p>
						<p class="other"><span><?php echo $data->promotion->product->zp_sale_num?>人已购买</span><span><em class="clock_txt"></em><em class="clock"></em></span></p>
					</li>
					<?php }}?>
				</ul>
			</div>
		</div>
		<div class="tab_cont">
			<div class="today_snapup">
				<ul class="list c_f">
					<!-- 推荐位-准点抢购 15点-->
					<?php $positdata = Positions::model()->getPosData('30');?>
					<?php if(!empty($positdata)){foreach($positdata as $data){?>
					<li class="c_f">
						<div class="c_img c_img180">
							<?php echo CHtml::link(Tool::thumb($data->promotion->zpt_pic,180,180,$data->promotion->zpt_title),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
						</div>
						<p class="title c_666 fs_14 fw_b">
							<?php echo CHtml::link(mb_substr($data->promotion->zpt_title,0,20,'utf8'),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
						</p>
						<p class="buy c_f bg_sale">
						<a class="btn f_r" href="snapup_detail.html"></a><strong class="fs_24 ff_yh c_white">￥<?php echo $data->promotion->zpt_price?></strong>
						</p>
						<p class="other c_666">
							<span class="old_price">原价：<del class="fw_b"><?php echo $data->promotion->product->zp_price?></del>元</span>
							<span class="count">限量：<?php echo $data->promotion->zpt_limit_nums?>份</span>
						</p>
						<p class="other"><span><?php echo $data->promotion->product->zp_sale_num?>人已购买</span><span><em class="clock_txt"></em><em class="clock"></em></span></p>
					</li>
					<?php }}?>
				</ul>
			</div>
		</div>
		<div class="tab_cont">
			<div class="today_snapup">
				<ul class="list c_f"  id="timer">
					<!-- 推荐位-准点抢购 20:30点-->
					<?php $positdata = Positions::model()->getPosData('31');?>
					<?php if(!empty($positdata)){foreach($positdata as $data){?>
					<li class="c_f">
						<div class="c_img c_img180">
							<?php echo CHtml::link(Tool::thumb($data->promotion->zpt_pic,180,180,$data->promotion->zpt_title),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
						</div>
						<p class="title c_666 fs_14 fw_b">
							<?php echo CHtml::link(mb_substr($data->promotion->zpt_title,0,20,'utf8'),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
						</p>
						<p class="buy c_f bg_sale">
						<a class="btn f_r" href="snapup_detail.html"></a><strong class="fs_24 ff_yh c_white">￥<?php echo $data->promotion->zpt_price?></strong>
						</p>
						<p class="other c_666">
							<span class="old_price">原价：<del class="fw_b"><?php echo $data->promotion->product->zp_price?></del>元</span>
							<span class="count">限量：<?php echo $data->promotion->zpt_limit_nums?>份</span>
						</p>
						<p class="other"><span><?php echo $data->promotion->product->zp_sale_num?>人已购买</span><span><em class="clock_txt"></em><em class="clock"></em></span></p>
					</li>
					<?php }}?>
				</ul>
			</div>
		</div>
		<div class="tomo_snapup">
			<h3 class="hd bg_sale"></h3>
			<div class="tomo_list">
				<ul class="c_f">
					<!-- 推荐位-明日预告-->
					<?php $positdata = Positions::model()->getPosData('32');?>
					<?php if(!empty($positdata)){foreach($positdata as $data){?>
					<li>
						<div class="c_img c_img70">
							<?php echo CHtml::link(Tool::thumb($data->promotion->zpt_pic,70,70,$data->promotion->zpt_title),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
						</div>
						<p class="title_pro">
							<?php echo CHtml::link(mb_substr($data->promotion->zpt_title,0,20,'utf8'),array('/home/product/detail','id'=>$data->promotion->zp_id,'active'=>'promotion'))?>
						</p>
						<p class="count c_666">限量：<?php echo $data->promotion->zpt_limit_nums?>份</p>
					</li>
					<?php }}?>
				</ul>
			</div>
		</div>
	</div>
</div>
<!--准点抢购 end-->
<div class="hr_12"></div>
<!--限时抢购 start-->
<div class="flash_sale list_hover">
	
			
	<div class="hd bg_x c_f">
		<h2 class="bg_sale f_l">限时抢购</h2>
		<p class="sort fs_14 fw_b f_l">
			<?php foreach($cateTop as $key=>$cate){?>
				<?php echo CHtml::link(CHtml::encode($cate->zca_title),array('list','id'=>$cate->zca_id),array('class'=>'sort_0'.($key+1)))?>
			<?php }?>
		</p>
	</div>
	<div class="bd bg_fff">
		<?php foreach($cateTop as $cate){?>
		<div class="snapup_pro">
			<div class="hd_pub c_f">
				<?php echo CHtml::link('更多',array('list','id'=>$cate->zca_id),array('class'=>'more bg_sale f_r'))?>
				<span class="fw_b fs_14"><?php echo CHtml::encode($cate->zca_title)?></span>
			</div>
			<div class="pro_list">
				<!-- 分类下最新活动产品-->
				<?php   
					$model->category_top = $cate->zca_id;//一级行业分类
					$this->widget('zii.widgets.CListView', array(  
					    'dataProvider'=>$model->search(4),  
					    'itemView'=>'_list_view',    
						'emptyText'=>"",
					    'template'=>'{items}',  
					    'pager'=>array('class'=>'CLinksPager'),
						'htmlOptions'=>array('class'=>'c_f'),
						'itemsTagName'=>'ul',
					    ));  
				?>  
			</div>
		</div>
		<?php }?>
	</div>	
</div>
<div class="allsort_nav promotion_sort bg_fff">
    <h2 class="ff_yh fs_15">限时抢购</h2>
    <ul>
    	<?php foreach($cateTop as $key=>$cate){?>
			<li><?php echo CHtml::link('<b class="ico ico_sort'.($key+1).'"></b>'.CHtml::encode($cate->zca_title),array('list','id'=>$cate->zca_id))?></li>
		<?php }?>
    </ul>
    <p class="view_all t_c">
    	<?php echo CHtml::link('查看全部促销',array('list','id'=>''),array('alt'=>'查看全部促销'))?>
    </p>	
</div>


<link href="<?php echo Yii::app()->request->baseUrl; ?>/css/style/style_snapup.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/snapup_timer.js"></script>
<script type="text/javascript">
$(function(){
	 $("#timeSnapup").TabADS();
	 $(".list_hover").Prolist();
	 $(".snapup .time").timeGo({callBackFunction:function(element,msg){
		 msg.html("时间到").show();
	}});
	new Marquee(
			{
			MSClassID : "slideBox",
			ContentID : "slideContent",
			TabID : "slideTab",
			Direction : 2,
			Step : 0.3,
			Width : 790,
			Height : 320,
			Timer : 20,
			DelayTime : 4000,
			WaitTime : 4000,
			ScrollStep: 790,
			SwitchType: 0,
			AutoStart : 1
	});
});
</script>
